Skip to content

Conversation

@thompson-tomo
Copy link
Contributor

This ensures that the stdout option is only being used when a single file is being processed. If not a single file, switch to dryrun and log the switch.

Closes #112

Further adjustments to stdout will be handled via #296

@thompson-tomo
Copy link
Contributor Author

thompson-tomo commented Dec 11, 2025

@AndrewSouthpaw / @PeterDaveHello i have added logic to ensure --stdout is only used on a single file to help explain the use case for using stdout. Further improvements will come via seperate pr.

@thompson-tomo
Copy link
Contributor Author

@AndrewSouthpaw any concerns with reducing the edge cases with stdout?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restricts the --stdout option to only work with single file processing, exiting with error code 2 if used with multiple files or directories. This addresses edge cases where stdout output would be ambiguous or unhelpful.

Changes:

  • Added validation to reject --stdout usage with multiple files or directories
  • Updated test fixtures from .md to .log format for stdout tests
  • Added new test case to verify error handling when --stdout is used with a directory
  • Updated README documentation to clarify --stdout limitation

Reviewed changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
doctoc.js Adds validation logic to exit with error code 2 when --stdout is used with multiple files or directories
test/transform-stdout.js Updates fixture file references from .md to .log and adds test for directory error case
test/fixtures/stdout.log New fixture file containing expected stdout output for single file processing
test/fixtures/stdout_run_on_directory.log New fixture file (appears unused) showing directory processing output
test/fixtures/invalid_stdout/readme.md New test fixture directory with sample markdown file for testing error case
README.md Documents that --stdout only works with single files
.gitignore Adds exception to allow .log files in test/fixtures directory

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants